package com.wangjiyuan.shiwupai.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.wangjiyuan.shiwupai.bean.guangchi.categorie.CategoriesBean;
import com.wangjiyuan.shiwupai.ui.fragment.guangchi.pager.PagerFragment;

import java.util.List;

/**
 * Created by wjy on 2016/11/28.
 */

public class GuangChiAdapter extends FragmentPagerAdapter {
    private List<PagerFragment> fragments;
    private List<CategoriesBean> categoriesBeanList;

    public GuangChiAdapter(FragmentManager fm, List<PagerFragment> fragments, List<CategoriesBean> categoriesBeanList) {
        super(fm);
        this.fragments = fragments;
        this.categoriesBeanList = categoriesBeanList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return categoriesBeanList.get(position).getName();
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
